home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_bab_elevcall.cog < prev    next >
Text File  |  1999-11-15  |  3KB  |  96 lines

  1. # Jones 3D Cog Script
  2. #
  3. # gen_ElevCall.cog
  4. #
  5. # This Cog controls one elevator that can be summoned to any number of floors
  6. # A cog must be placed at each floor to be attached to the call button, the up and down
  7. # buttons, and the elevator.
  8. # You have to manually assign to each cog what floor level it is on.
  9. # Remember that the elevators first frame is 0 even though your first floor may be one.
  10. #
  11. # [SXC]
  12. #
  13. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  14. # ========================================================================================
  15.  
  16.  
  17. symbols
  18.     message    activate
  19.     message    user0
  20.  
  21.     thing        callbutton                       //calls elevator to level
  22.     thing        upbutton                         //sends elevator up
  23.     thing        dnbutton                         //sends elevator down
  24.  
  25.     thing        elevator                         //currently handles only one elevator
  26.  
  27.     float        speed=5.0                        //sets speed default is 5
  28.     float        floorlevel=0.0                   //sets floor level for each cog
  29.     float        totalfloors=0.0                  //lastfloor + 1
  30. #    sound        callbutt=beep2.wav    local        //button sounds
  31. #    sound        updnbutt=beep1.wav    local
  32.  
  33.     int        switch                    local        //check variable for cog internal use
  34.     int        bnosound=0                local
  35.     int        movespeed=2                local
  36. end
  37.  
  38. # .......................................................................................
  39.  
  40. code
  41.  
  42. # .......................................................................................
  43. activate:
  44.  
  45.    switch = GetSenderRef();
  46.         if ((GetCurFrame(elevator) == floorlevel) &&       //if elevator is at the current floor
  47.             (switch == callbutton))
  48.         {
  49.               MoveToFrame(callbutton, 0, movespeed);
  50.         }
  51.    else if ((switch == callbutton) &&                         //if callbutton is pushed
  52.             (bnosound == 0))
  53.         {
  54.          // PlaySoundPos(callbutt, GetSurfaceCenter(callbutton), 0.6, -1, -1, 0 );
  55.          bnosound = 1;
  56.          MoveToFrame(callbutton, 1, movespeed);
  57.          MoveToFrame(elevator,floorlevel,speed);
  58.          WaitForStop(elevator);
  59.          bnosound = 0;
  60.          MoveToFrame(callbutton, 0, movespeed);
  61.         }
  62.    else if ((switch == upbutton) &&                        //if upbutton is pushed
  63.             (floorlevel == GetCurFrame(elevator)) &&
  64.             (GetCurFrame(elevator) < totalfloors))
  65.         {
  66.          // PlaySoundPos(updnbutt, GetSurfaceCenter(upbutton), 0.6, -1, -1, 0 );
  67.          MoveToFrame(upbutton, 1, movespeed);
  68.          MoveToFrame(elevator,(floorlevel+1),speed);
  69.          WaitForStop(elevator);
  70.          MoveToFrame(upbutton, 0, movespeed);
  71.         }
  72.    else if ((switch == dnbutton) &&                        //if down button is pushed
  73.             (floorlevel == GetCurFrame(elevator)) &&
  74.             (floorlevel > 0))
  75.         {
  76.          // PlaySoundPos(updnbutt, GetSurfaceCenter(dnbutton), 0.6, -1, -1, 0 );
  77.          MoveToFrame(dnbutton, 1, movespeed);
  78.          MoveToFrame(elevator, (floorlevel-1), speed);
  79.          WaitForStop(elevator);
  80.          MoveToFrame(dnbutton, 0, movespeed);
  81.         }
  82.         return;
  83.  
  84. # .......................................................................................
  85. user0:
  86.  
  87.     MoveToFrame(callbutton, 0, movespeed);
  88.     MoveToFrame(upbutton, 0, movespeed);
  89.     MoveToFrame(dnbutton, 0, movespeed);
  90.     return;
  91. # .......................................................................................
  92.  
  93. end
  94.  
  95.  
  96.